#include <cstdio>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
vector<long long> fac;
set<pair<long long,long long>> s; 
long long l,r,x,y;
long long gcd(long long a,long long b){
    return b==0?a : gcd(b,a%b);
}
int main(void){
    scanf("%lld%lld%lld%lld",&l,&r,&x,&y);
    for(long long i=1;i*i<=y;i++){
        if(y%i==0){
            fac.push_back(i);
            if(i!=y/i){
                fac.push_back(y/i);
            }
        }
    }   
    int len=fac.size();
    for(int i=0;i<len;i++){
        for(int j=0;j<len;j++){
            if(fac[i]>=l && fac[i]<=r && fac[j]>=l && fac[j]<=r && gcd(fac[i],fac[j])==x && x*y==fac[i]*fac[j]){
                s.insert({fac[i],fac[j]});
            }
        }
    }
    printf("%d\n",int(s.size()));
    return 0;
}